package com.tengju.user.domain.model.survey;

import lombok.Getter;

import java.util.Arrays;

@Getter
public enum SurveyQuestionRequireEnum {

    REQUIRED(1,"必填"),
    NOT_REQUIRED(2,"选填");

    private Integer code;
    private String desc;

    SurveyQuestionRequireEnum(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public static SurveyQuestionRequireEnum parseByCode(Integer code) {
        return Arrays.stream(SurveyQuestionRequireEnum.values())
                .filter(k -> k.getCode().equals(code))
                .findFirst().orElse(null);
    }

}
